﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace ZX.Report
{
    /// <summary>
    /// 报表参数基类
    /// </summary>
    public abstract class ParamsFactory
    {
        /// <summary>
        /// 报表类型
        /// </summary>
        public ReportType reportType { get; set; }
        /// <summary>
        /// 数据源
        /// </summary>
        public DataSet reportDataSource { get; set; }
        /// <summary>
        /// 纸张大小
        /// </summary>
        public System.Drawing.Printing.PaperKind pagerSize { get; set; }
       
        /// <summary>
        /// 获取报表基类实例
        /// </summary>
        /// <param name="reportType"></param>
        /// <param name="ds"></param>
        /// <returns></returns>
        public static ParamsFactory GetInstance(ReportType reportType,DataSet ds)
        {
            ParamsFactory paramsFactory = null;
            try
            {
                if (reportType == ReportType.List)
                {
                    paramsFactory = ListParams.GetInstance(ds);
                }
                else if (reportType == ReportType.Chart)
                {
                    paramsFactory = ChartParams.GetInstance(ds);
                }
            }
            catch 
            { }
            return paramsFactory;
        }
    }
}
